﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Extjs_ReGSharp.Sorting.Factory;

namespace Extjs_ReGSharp.Sorting
{
	internal class ComparisonFactory<T> : IComparisonFactory<T>
	{

		public IDefaultComparer<T> GetComparerByType(Type fieldType)
		{
			if (fieldType == typeof(int) || fieldType == typeof(int?))
			{
				return new IntComparer<T>();
			}

			if (fieldType == typeof(string))
			{
				return new StringComparer<T>();
			}

			if (fieldType == typeof(DateTime))
			{
				return new DateTimeComparer<T>();
			}

			if (fieldType == typeof(bool))
			{
				return new BooleanComparer<T>();
			}

			return null;
		}
	}
}
